/**
 * create by young (young2f@outlook.com) on 2020/9/12
 */

'use strict';
import React from 'react';
import {connect} from 'dva/index';
import {Card, Col, DatePicker, Form, Row, Select, Statistic, Table} from 'antd';
import styles from '../../index.less';
import ViewTitle from '../../../components/ViewTitle';
import FormBase from '../../../components/Base/FormBase';
import moment from 'moment';
import 'moment/locale/zh-cn';

moment.locale('zh-cn');
const {RangePicker} = DatePicker;
const _ = require('lodash');

const {Option} = Select;
@Form.create()
@connect(({
            user,
            global,
            dynamicLabel,
            procure,
            finance
          }) => ({...user, ...global, ...procure, ...finance, ...dynamicLabel}))
export default class FixedAssets extends FormBase {
  constructor(props) {
    super(props);
    this.state = {};
  }
  componentDidMount() {

  }

  cols() {
    return [
      {
        title: '固定资产',
        dataIndex: 'treeName',
        key: 'treeName',
      },
      {
        title: '户名',
        dataIndex: 'accountName',
        key: 'accountName',
      },
      {
        title: '开户行',
        dataIndex: 'openingBank',
        key: 'openingBank'
      },
      {
        title: '账号',
        dataIndex: 'account',
        key: 'account'
      },
      {
        title: '金额',
        dataIndex: 'paymentAmount',
        key: 'paymentAmount'
      },
      {
        title: '创建时间',
        dataIndex: 'createdTs',
        key: 'createdTs',
        render: (text, record) => {return<div>{moment(text).format('YYYY-MM-DD')}</div>}
      },
      {
        title: '经办人',
        dataIndex: 'createUsername',
        key: 'createUsername'
      },
      // {
      //   title: '操作', dataIndex: 'operation', key: 'operation',
      //   width: 120, fixed: 'right',
      //   render: (value, record) => {
      //     return (
      //       <span>
      //      {<a style={{marginRight: '6px'}}
      //          onClick={() => {
      //
      //          }}>详情</a>}
      //
      //       </span>
      //     );
      //   }
      // }
    ];
  }
  render() {
    const {fixedAssess = {}} = this.props;
    console.log('fixedAssetsAssess',fixedAssess);
    const{land=0,estate=0,engineering=0,furniture=0,office=0,tool=0,device=0,car=0,list=[]}=fixedAssess
    return <div><Row gutter={16}>
      <Col span={6}>
        <Card>
          <Statistic
            title="土地"
            value={land}
            precision={2}
            valueStyle={{color: '#11f'}}
            suffix="元"
          />
        </Card>
      </Col>
      <Col span={6}>
        <Card>
          <Statistic
            title="房产"
            value={estate}
            precision={2}
            valueStyle={{color: '#11f'}}
            suffix="元"
          />
        </Card>
      </Col>
      <Col span={6}>
        <Card>
          <Statistic
            title="附属工程"
            value={engineering}
            precision={2}
            valueStyle={{color: '#11f'}}
            suffix="元"
          />
        </Card>
      </Col>
      <Col span={6}>
        <Card>
          <Statistic
            title="家具家电"
            value={furniture}
            precision={2}
            valueStyle={{color: '#11f'}}
            suffix="元"
          />
        </Card>
      </Col>

      <Col span={6}>
        <Card>
          <Statistic
            title="办公设备"
            value={office}
            precision={2}
            valueStyle={{color: '#11f'}}
            suffix="元"
          />
        </Card>
      </Col>

      <Col span={6}>
        <Card>
          <Statistic
            title="仪器仪表"
            value={tool}
            precision={2}
            valueStyle={{color: '#11f'}}
            suffix="元"
          />
        </Card>
      </Col>
      <Col span={6}>
        <Card>
          <Statistic
            title="机械设备"
            value={device}
            precision={2}
            valueStyle={{color: '#11f'}}
            suffix="元"
          />
        </Card>
      </Col>
      <Col span={6}>
        <Card>
          <Statistic
            title="车辆"
            value={car}
            precision={2}
            valueStyle={{color: '#11f'}}
            suffix="元"
          />
        </Card>
      </Col>
    </Row>
      <ViewTitle
        title={'固定资产记录'}
      ></ViewTitle>
      <Table
        className={styles.antTable}
        bordered={true}
        columns={this.cols()}
        dataSource={list}
        scroll={{x: true}}
        pagination={true}
        //scroll={{ x: 1300 }}
      ></Table>
    </div>;
  }
}
